rename var1 id
rename var2 user_id
rename var3 block
rename var4 incentive
rename var5 number
rename var6 true_state
rename var7 chosen_act

gen qid=1
replace qid=2 if incentive==95

gen correct=0
replace correct=1 if true_state==chosen_act




gen response=0
replace response=1 if chosen_act==1





gen state_2_DP_3=0
replace state_2_DP_3=1 if true_state==2 & qid==1
gen state_1_DP_4=0
replace state_1_DP_4=1 if true_state==1 & qid==2
gen state_2_DP_4=0
replace state_2_DP_4=1 if true_state==2 & qid==2


reg response state_2_DP_3 state_1_DP_4 state_2_DP_4, cluster(user_id)
test -state_2_DP_3=state_1_DP_4-state_2_DP_4



nlcom (ratio1_1: 5/((ln(_b[_cons])/(2*_b[_cons]+_b[state_2_DP_3]))-(ln((1-_b[_cons])/(1-_b[_cons]+(1-_b[_cons]-_b[state_2_DP_3])))))) (ratio1_2: 5/((ln((1-_b[_cons]-_b[state_2_DP_3]))/((1-_b[_cons]-_b[state_2_DP_3])+(1-_b[_cons])))-(ln((_b[_cons]+_b[state_2_DP_3])/(2*_b[_cons]+_b[state_2_DP_3])))))  (ratio2_1: 95/(((ln((_b[_cons]+_b[state_1_DP_4])/(2*_b[_cons]+_b[state_1_DP_4]+_b[state_2_DP_4]))-(ln((1-_b[_cons]-_b[state_1_DP_4])/((1-_b[_cons]-_b[state_1_DP_4])+(1-_b[_cons]-_b[state_2_DP_4])))))))) (ratio2_2: 95/((ln((1-_b[_cons]-_b[state_2_DP_4]))/((1-_b[_cons]-_b[state_2_DP_4])+(1-_b[_cons]-_b[state_1_DP_4])))-(ln((_b[_cons]+_b[state_2_DP_4])/(2*_b[_cons]+_b[state_2_DP_4]+_b[state_1_DP_4]))))) 




logit response state_2_DP_3 state_1_DP_4 state_2_DP_4, cluster(user_id)